package com.enjoyor.soa.traffic.rest.efoms.dubbo.impl;

import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Reference;
import com.enjoyor.soa.traffic.api.dto.efoms.WorkordersRecordInfoDto;
import com.enjoyor.soa.traffic.api.service.dubbo.efoms.IDubboWorkordersRecordService;
import com.enjoyor.soa.traffic.rest.efoms.dubbo.IWorkordersRecordConsumeService;
import com.enjoyor.soa.traffic.util.helper.ResultHelper;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;

@Component
public class WorkordersRecordConsumeService implements IWorkordersRecordConsumeService {

	@Reference(version = "1.0.0", timeout = 10000)
	//@Reference(version = "1.0.0", timeout = 10000, url="dubbo://192.168.56.8:21141")
	//@Reference(version = "1.0.0", timeout = 10000, url="dubbo://192.168.20.77:21141")
	private IDubboWorkordersRecordService dubboWorkordersRecordService;
	
	
	@Override
	public ResultPojo insertWorkordersRecord(WorkordersRecordInfoDto workordersRecordDto, String isRecover, 
			String roleName, String personName) {
		// TODO Auto-generated method stub
		ResultPojo resultPojo = new ResultPojo();
		try {
			resultPojo = dubboWorkordersRecordService.insertWorkordersRecord(workordersRecordDto, isRecover, 
					roleName, personName);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			return ResultHelper.getResult(e);
		}
		return resultPojo;
	}
	
	@Override
    public ResultPojo getNextProcess(String workordersId) {
		// TODO Auto-generated method stub
		ResultPojo resultPojo = new ResultPojo();
		try {
			resultPojo = dubboWorkordersRecordService.getNextProcess(workordersId);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			return ResultHelper.getResult(e);
		}
		return resultPojo;
	}
}
